﻿// Closer handles a click event to close a target
define([
    'Wjs/ui/widgets/tools/Tool'
],
function () {
    'use strict';

    return Wjs.defineOnce({

        type: 'Closer',

        internal: {

            base: Wjs.getType('Tool'),

            initialize: function (cfg, parent) {
                var me = this;

                me.addClass('w-closer');

                me.onClick(function () {
                    me.target.close();
                });
            }
        },

        setTarget: function (target) {

            this.target = target;

            return this;
        }

    });

});